<?php

Class Mgantipassword extends Ci_Model
{
	function __construct()
	{
    	parent:: __construct();
    	$this->load->database();
    }	

    function cekpaslama($username,$pwd_lama)
    {
        $sql = "select count(password) as ada from pengguna where username = '$username' and password = '$pwd_lama'";
        $row = $this->db->query($sql)->row();

        return $row->ada;
    }

    function change_password($username,$pwd_baru)
    {
        $sql = "update pengguna set password = '$pwd_baru' where username = '$username'";
        return $this->db->query($sql);
    }
}